<?php
use p5\objects\HtmlUtils;

function tag($name, $attributes = array(), $innerHTML = "")
{
    return HtmlUtils::tag($name, $attributes, $innerHTML);
}


function next_id($defaultValue)
{
    return HtmlUtils::next_id($defaultValue);
}

function to_html($str)
{
    return HtmlUtils::to_html($str);
}

function make_boolean_search_select($name, $default_value = "1", $onChangeMethod = "")
{
    return HtmlUtils::make_boolean_radio($name, $default_value, $onChangeMethod);
}

function make_select($name, $matrix, $default_value = "", $nullable = 1, $emptyLabel = "", $attributes = array())
{
    return HtmlUtils::make_select($name, $matrix, $default_value, $nullable, $emptyLabel, $attributes);
}

function make_options($matrix, $default_value = "", $nullable = 1, $emptyLabel = "")
{
    return HtmlUtils::make_options($matrix, $default_value, $nullable, $emptyLabel);
}

function make_checkbox($name, $matrix, $list = array(), $attributes = array(), $cols = 0)
{
    return HtmlUtils::make_checkbox($name, $matrix, $list, $attributes, $cols);
}

function make_radio($name, $matrix, $defaultValue = "", $attributes = array(), $cols = 0)
{
    return HtmlUtils::make_radio($name, $matrix, $defaultValue, $attributes, $cols);
}


function make_boolean_radio($name, $defaultValue = 0, $attributes = array())
{
    return HtmlUtils::make_boolean_radio($name, $defaultValue, $attributes);
}

function make_gender_radio($name = "gender", $defaultValue = "0", $attributes = array())
{
    return HtmlUtils::make_gender_radio($name, $defaultValue, $attributes);
}


function make_search_input($name, $defaultValue = "", $size = 16)
{
    $value = deep_get($name, 1, $defaultValue);
    return "<input type=text class='text' name='$name' id='$name' value=\"$value\" size=$size>";
}


function get_date_options()
{
    $matrix = array();
    $matrix["TODAY"] = "今天";
    $matrix["YESTERDAY"] = "昨天";
    $matrix["THIS_WEEK"] = "本周";
    $matrix["LAST_WEEK"] = "上周";
    $matrix["LAST_7_DAYS"] = "近7天内";
    $matrix["THIS_MONTH"] = "本月";
    $matrix["LAST_MONTH"] = "上个月";
    $matrix["LAST_30_DAYS"] = "近30天内";
    $matrix["THIS_YEAR"] = "今年";
    $matrix["LAST_YEAR"] = "去年";
//	$matrix[""] = "自定义";
    return $matrix;
}